//
//  BaseTableViewController.swift
//  chaorenWeibo
//
//  Created by tanchao on 15/7/28.
//  Copyright © 2015年 chaoren. All rights reserved.
//

import UIKit

class BaseTableViewController: UITableViewController,VisitorViewDelegate {

    var visitorView :VisitorView?
    override func loadView() {
        UserAccount.didLogon ? super.loadView() : setVistorView()
        
    }
    private func setVistorView()
    {
        visitorView = VisitorView()
        visitorView?.delegate = self
        view = visitorView
        /// 设置标题栏
        navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorViewRegistorBtnClick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self, action: "visitorViewLoginBtnClick")
    }
//    MARK:- VisitorViewDelegate方法
    func visitorViewLoginBtnClick() {
        let nav = UINavigationController(rootViewController: oAuthController())
        presentViewController(nav, animated: true, completion: nil)
    }
    func visitorViewRegistorBtnClick() {
        print("注册")
    }
}